<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title><%= htmlWebpackPlugin.options.title %></title>

    <script src="http://quicktest.com/assets/unpkg/vue/dist/vue.global.js"></script>

</head>
<style>
    #app {
        height: 100%;
    }
    .first-loading-wrp {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        min-height: 420px;
        height: 100%
    }

    .first-loading-wrp > h1 {
        font-size: 128px
    }

    .first-loading-wrp .loading-wrp {
        padding: 98px;
        display: flex;
        justify-content: center;
        align-items: center
    }

    .dot {
        animation: antRotate 1.2s infinite linear;
        transform: rotate(45deg);
        position: relative;
        display: inline-block;
        font-size: 32px;
        width: 32px;
        height: 32px;
        box-sizing: border-box
    }

    .dot i {
        width: 14px;
        height: 14px;
        position: absolute;
        display: block;
        background-color: #1890ff;
        border-radius: 100%;
        transform: scale(.75);
        transform-origin: 50% 50%;
        opacity: .3;
        animation: antSpinMove 1s infinite linear alternate
    }

    .dot i:nth-child(1) {
        top: 0;
        left: 0
    }

    .dot i:nth-child(2) {
        top: 0;
        right: 0;
        -webkit-animation-delay: .4s;
        animation-delay: .4s
    }

    .dot i:nth-child(3) {
        right: 0;
        bottom: 0;
        -webkit-animation-delay: .8s;
        animation-delay: .8s
    }

    .dot i:nth-child(4) {
        bottom: 0;
        left: 0;
        -webkit-animation-delay: 1.2s;
        animation-delay: 1.2s
    }

    @keyframes antRotate {
        to {
            -webkit-transform: rotate(405deg);
            transform: rotate(405deg)
        }
    }

    @-webkit-keyframes antRotate {
        to {
            -webkit-transform: rotate(405deg);
            transform: rotate(405deg)
        }
    }

    @keyframes antSpinMove {
        to {
            opacity: 1
        }
    }

    @-webkit-keyframes antSpinMove {
        to {
            opacity: 1
        }
    }
</style>
<body >
<div id="app" v-cloak>
    <div class="first-loading-wrp">
        <h1>Quick</h1>
        <div class="loading-wrp">
            <span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
        </div>
        <div style="display: flex; justify-content: center; align-items: center;">QuickAdmin</div>
    </div>
</div>

<!-- built files will be auto injected -->
</body>
<script>

    let xhr = new XMLHttpRequest(); // 创建XMLHttpRequest 实例


    xhr.open("get", "/index.php/admin/index/resource", false); //设置为同步get请求
    xhr.send(null); // 开始发送请求，并且阻塞后续代码执行，直到拿到响应
    if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {

        let data = JSON.parse(xhr.responseText);
        if (data.code === 0) {

            window.config = data.data.config;
            window.Quick = new CreateQuick(config);

            for (let j in data.data.styles) {
                document.write('<link rel="stylesheet" href="' + data.data.styles[j] + '" />');
            }

            for (let i in data.data.scripts) {
                document.write('<script src="' + data.data.scripts[i] + '" type="text/javascript" charset="utf-8"><\/script>');
            }



        }



        xhr.open("get", "/index.php/admin/index/viewComponent", false); //设置为同步get请求
        xhr.send(null); // 开始发送请求，并且阻塞后续代码执行，直到拿到响应
        if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
            document.write(xhr.responseText);

            window.onload = function(){
                Quick.inits();
            }

            // console.log(xhr.responseText) // 检验状态码
        } else {
            console.log('请求失败')
        }

        // document.write(xhr.responseText);
        // Quick.inits();
        // console.log(xhr.responseText) // 检验状态码
    } else {
        console.log('请求失败')
    }




</script>
</html>
